<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>主页一</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
</head>
<style>
    .layui-top-box {padding:40px 20px 20px 20px;color:#fff}
    .panel {margin-bottom:17px;background-color:#fff;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05); cursor: pointer;}
    .panel-body {padding:15px}
    .panel-title {margin-top:0;margin-bottom:0;font-size:14px;color:inherit}
    .label {display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;margin-top: .3em;}
    .layui-red {color:red}
    .main_btn > p {height:40px;}
</style>
<body>
<div class="layuimini-container">
    <div class="layuimini-main layui-top-box">
        <div class="layui-row layui-col-space10" id="sellerBox">
            <div class="layui-col-md3">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-cyan" id="czBtn">
                        <div class="panel-body">
                            <div class="panel-title">
                                <img src="/images/cz.png" width="80" height="80">
                            </div>
                            <div class="panel-content">
                                <h1 class="stat-percent font-bold text-gray">充值</h1>
                                <small>点击进入充值页面</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-col-md3">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-blue" id="ffBtn">

                        <div class="panel-body">
                            <div class="panel-title">
                                <img src="/images/ff.png" width="80" height="80">
                            </div>
                            <div class="panel-content">
                                <h1 class="stat-percent font-bold text-gray">发放</h1>
                                <small>点击进入发放页面</small>
                            </div>
                        </div>


                    </div>
                </div>
            </div>

            <div class="layui-col-md3">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-green" id="kpBtn">

                        <div class="panel-body">
                            <div class="panel-title">
                                <img src="/images/kp.png" width="80" height="80">
                            </div>
                            <div class="panel-content">
                                <h1 class="stat-percent font-bold text-gray">开票</h1>
                                <small>点击进入申请开票页面</small>

                            </div>
                        </div>

                    </div>
                </div>
            </div>
            <div class="layui-col-md3">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-orange" id="yeBtn">

                        <div class="panel-body">
                            <div class="panel-title">
                                <img src="/images/ye.png" width="80" height="80">
                            </div>
                            <div class="panel-content">
                                <h1 class="stat-percent font-bold text-gray">余额: <span id='money'></span>
                                </h1>
                                <small>点击进入余额明细页面</small>
                            </div>
                           
                        </div>

                    </div>
                    
                </div>
            </div>
        </div><!--   seller box -->
        <div class="layui-card">
                <div class="layui-card-header"><i class="fa fa-fire icon"></i>商户信息</div>
                <div class="layui-card-body layui-text">
                    <table class="layui-table">
                        <tbody>
                        <tr>
                            <td width="150">商户名称</td>
                            <td id="sellerName">
                                layuimini
                            </td>
                        </tr>
                        <tr>
                            <td>纳税人识别号</td>
                            <td id="taxPayerCode"></td>
                        </tr>
                        <tr>
                            <td>ip白名单</td>
                            <td id="adoptIp"></td>
                        </tr>
                        <tr>
                            <td>注册时间</td>
                            <td id="createTime"></td>
                        </tr>
<!--                         <tr> -->
<!--                             <td>最后一次登录时间</td> -->
<!--                             <td id="serviceCode"></td> -->
<!--                         </tr> -->
                        <tr>
                            <td>appkey</td>
                            <td id="appKey"></td>
                        </tr>
                        <tr>
                            <td>appSecret</td>
                            <td id="appSecret"></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
    </div>

</div>
<script src="../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['jquery', 'layer', 'tfApi'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            API = layui.tfApi,
            storage = localStorage,//window.sessionStorage,
            element = layui.element,
            getServiceArr = storage.getItem("sellerInfo"),
            sellerInfo = JSON.parse(getServiceArr);
        
        
        $("#sellerName").html(sellerInfo.sellerName);
        $("#taxPayerCode").html(sellerInfo.taxPayerCode);
        $("#createTime").html(sellerInfo.createTime);
//        $("#sellerName").html(sellerInfo.sellerName);
        $("#appKey").html(sellerInfo.appKey);
        $("#appSecret").html(sellerInfo.appSecret);
        $("#adoptIp").html(sellerInfo.adoptIp);
        
        
        $("#czBtn").click(function () {
        	 var index = layer.open({
                 title: '充值页面',
                 type: 2,
                 shade: 0.2,
                 maxmin:true,
                 shadeClose: true,
                 area: ['100%', '100%'],
                 content: '../page/topup.html',
                 success: function (layero, index) {
                 }
             });
        });
        $("#ffBtn").click(function () {
            var index = layer.open({
                title: '发放页面',
                type: 2,
                shade: 0.2,
                maxmin:true,
                shadeClose: true,
                area: ['100%', '100%'],
                content: '../page/expenses.html',
                success: function (layero, index) {
                }
            });
        });
        $("#kpBtn").click(function () {
                var index = layer.open({
                    title: '开票页面',
                    type: 2,
                    shade: 0.2,
                    maxmin:true,
                    shadeClose: true,
                    area: ['100%', '100%'],
                    content: '../page/invoice/apply.html',
                    success: function (layero, index) {
                    }
                });
        });
        $("#yeBtn").click(function () {
        	var index = layer.open({
                title: '余额明细页面',
                type: 2,
                shade: 0.2,
                maxmin:true,
                shadeClose: true,
                area: ['100%', '100%'],
                content: '../page/balance.html',
                success: function (layero, index) {
                }
            });
        });
        
        $(function(){
        	$.ajax({
                // 几个参数需要注意一下
                async: false,
                type: "POST",// 方法类型
                // dataType: "json",//预期服务器返回的数据类型
                url: API.CURL + '/seller/findByMoney',
                //data: {"id": id, "price": $("#price").val()},
                success: function (data) {
                	if(data == ''){
                		$("#money").html('0.00');
                	}else{
                		$("#money").html("<b>"+API.numFun(data)+"</b>");
                	}
                },
                error : function() {
                	layer.alert("异常！");
                }
            });
        });

    });
</script>
</body>
</html>